home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
tcoop10a.zip
/
DOC.ZIP
/
LIST.DOC
< prev
next >
Wrap
Text File
|
1991-11-20
|
4KB
|
115 lines
LIST.DOC 11/10/91 Copyright (c) 1991 by James S. Clark
==========================================================================
LIST
List Class
--------------------------------------------------------------------------
Class Name List
Superclass <none>
Category List
Other classes referenced Node
Other catagories referenced <none>
Used by many
Inherited by many
Declaration List *list = new List;
Instance Variables
Node *first;
Node *last;
Instance Methods
List (int (*compare)
(void *node1, void *node2) = NULL);
virtual ~List (void);
Node *add (Node *node);
Node *add (Node *before, Node *node);
Node *after (Node *node);
Node *before (Node *node);
List *copy (int start, int end);
int count (void);
void destroy (void);
Node *get (int index);
int includes(Node *node)
Node *remove (Node *node);
void sort (void);
List& operator + (Node *node);
List& operator - (Node *node);
--------------------------------------------------------------------------
GENERAL DESCRIPTION
The List Class provides the methods for manipulating single and double-
linked lists. It methods perform a number of actions commonly needed
for list management. It uses two variables, first and last, that point
to the head and tail of the List.
Specialized list classes may be derived from the List Class to create
lists that function in different ways.
--------------------------------------------------------------------------
VARIABLES
Node *first;
first points to the first Node in a List.
Node *last;
last points to the last node in a List.
int (*comparefunc)(void *node1, void *node2);
comparefunc points to a function that is used to test nodes
for insertion and sorting.
--------------------------------------------------------------------------
METHODS
List (int (*compare)(void *node1, void *node2) = NULL);
Constructor creates a new instance of the List Class with both
pointers set to NULL.
virtual ~List (void);
Destructor deletes the List point.
Node *add (Node *node);
Adds a Node to the end of the List.
Node *add (Node *before, Node *node);
Inserts a Node in front of the Node matching the before Node.
Node *after (Node *node);
Return a pointer to the next Node in the List.
Node *before (Node *node);
Returns a pointer to the previous Node in the List.
List *copy (int start, int end);
Returns a List containing the range of Nodes between the start
and end values. (not implemented as of 11/10/91)
int count (void);
Returns the number of Nodes in a List.
void destroy (void);
Deletes the Nodes in a List but does not deallocate the List.
Use the destructor for that.
Node *get (int index);
Returns a pointer to the node in a list by index number.
int includes(Node *node);
Test to see if Node is included in a List.
Node *remove (Node *node);
Removes a Node from a List.
void sort (void);
Sorts the List using the compare function passed at the time
of the Lists creation.
List& operator + (Node *node);
An operator that uses add to append a Node to the end of a List.
List& operator - (Node *node);
An operator that uses remove to delete a Node from a list.
--------------------------------------------------------------------------
LIST.DOC Copyright (c) 1991 by James S. Clark
==========================================================================